function loadCreatePlayer() {
  $('#main').html(template('t_createPlayer'))
  $('input').keydown(function() {
    $('.warning').empty()
  })
  var attriPoint = templateConfig.total[100001].basicAttri.attriPoint
  var str = templateConfig.total[100001].basicAttri.str
  var con = templateConfig.total[100001].basicAttri.con
  var agile = templateConfig.total[100001].basicAttri.agile
  var wisdom = templateConfig.total[100001].basicAttri.wisdom
  var attri = [0, 0, 0, 0]
  randomAttri()

  function randomAttri() {
    attri = [0, 0, 0, 0]
    var i = 0
    while (i < attriPoint) {
      var index = Math.floor(Math.random() * 4)
      if (attri[index] < 5) {
        attri[index] += 1
        i++
      }
    }
    $('.str').html(attri[0] + str)
    $('.con').html(attri[1] + con)
    $('.agile').html(attri[2] + agile)
    $('.wisdom').html(attri[3] + wisdom)
  }

  $('.randomAttri').click(function() {
    randomAttri()
  })

  $('.createPlayer').click(function() {
    var name = $('.playerName').val()
    if (name === '') {
      $('.warning').html('*角色名不能为空')
      return
    }

    if (name.length > 6) {
      $('.warning').html('*角色名长度不能超过6个字符')
      return
    }

    request.createPlayer(name, localStorage.username, base32.encode(localStorage.password), attri[0], attri[1], attri[2], attri[3], function() {
      request.playerLogin(localStorage.username, base32.encode(localStorage.password), function() {
        LoadShowContent(CONTENT[1], function() {
          $('#showContent').click(function() {
            $('#showContent').remove()
          })
        })
      })
    })
  })
}
